package com.leyu.mall.admin.cms.service.impl;

import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.leyu.mall.admin.cms.dao.CmsNewsMapper;
import com.leyu.mall.admin.cms.domain.CmsNews;
import com.leyu.mall.admin.cms.service.ICmsNewsService;
import com.leyu.mall.common.facade.ICmsNewsFacade;
@Service
@Scope("singleton")
@Transactional(rollbackFor = Exception.class)
public class CmsNewsServiceImpl implements ICmsNewsService, ICmsNewsFacade
{
	@Resource(name = "cmsNewsMapper")
	private CmsNewsMapper	cmsNewsMapper;

	public CmsNews getCmsNewsById(Long entity_id) throws Exception
	{
		return cmsNewsMapper.getCmsNewsById(entity_id);
	}

	public void save(CmsNews entity) throws Exception
	{
		if (entity.getNewsId() == null)
		{
			cmsNewsMapper.addCmsNews(entity);
		} else
		{
			cmsNewsMapper.updateCmsNews(entity);
		}
	}

	public void deleteCmsNews(Long id) throws Exception
	{
		cmsNewsMapper.deleteCmsNews(id);
	}

	public List<CmsNews> getAllCmsNews() throws Exception
	{
		return cmsNewsMapper.getAllCmsNews();
	}

	public List<CmsNews> getNewsListByPage(CmsNews pagebean) throws Exception
	{
		return cmsNewsMapper.getNewsListByPage(pagebean);
	}

	public int getNewsListByPageCount() throws Exception
	{
		return cmsNewsMapper.getNewsListByPageCount();
	}
}